package com.vanysoft.business.example;

import com.vanysoft.framework.utils.JSONResponse;
import com.vanysoft.framework.utils.file.FileException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/example/restAPI")
public class ExampleRestController {


    @RequestMapping(value = "/rest", produces = "application/json;charset=UTF-8")
    public String upload() {//1
        return "hello";
    }

    @RequestMapping(value = "/rest2", produces = "application/json;charset=UTF-8")
    public JSONResponse uploadFiles() throws FileException {
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("2", "321");

        return new JSONResponse(resultMap);
    }

    @RequestMapping(value = "/permission", produces = "application/json;charset=UTF-8")
    public JSONResponse permission(HttpServletRequest request) {
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("2", "321");

        return new JSONResponse(resultMap);
    }
}
